import com.ruoyi.car.service.ICarMaintenanceService;
import com.ruoyi.common.annotation.Log;
import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.stereotype.Service;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.Map;

/**
 * @Author Gao.ZhiHao
 * @Date 2022/12/3 22:55
 */
@SpringBootTest(classes = XXXXtest.class)
@SpringBootConfiguration
public class XXXXtest {

    @Test
    public void test() throws NoSuchFieldException, IllegalAccessException {
        Service annotation = ICarMaintenanceService.class.getAnnotation(Service.class);
        String title = annotation.value();
        System.out.println("title:"+title);
        InvocationHandler invocationHandler = Proxy.getInvocationHandler(annotation);
        Field memberValues = invocationHandler.getClass().getDeclaredField("memberValues");
        memberValues.setAccessible(true);
        Map xxx =  (Map)memberValues.get(invocationHandler);
        xxx.put("value","xxxxxx");
        String title1 = annotation.value();
        System.out.println("title1:"+title1);
    }
}
